//当前这个模块 API进行统一管理
import requests from "./request";

import mockRequests from './mockAjax'
//三级联动接口
//api/product/getBaseCategoryList get 无参数
//axios发请求返回promise对象
export const reqCategoryList = () => requests.get('/product/getBaseCategoryList');
//获取banner轮播图数据
export const reqGetBannerList = () => mockRequests.get('/banner');
//获取floor数据
export const reqGetFloorList = () => mockRequests.get('/floor')
//获取搜索模块数据
//api/list  post  有参数
export const reqGetSearchInfo = (params) => requests({ url: '/list', method: 'post', data: params })
//获取产品详情信息 
export const reqGetGoodsInfo = (id) => requests.get(`/item/${id}`)
//加入购物车 /api/cart/addToCart/{ skuId }/{ skuNum } post
export const addGetShopCart = (id, skuNum) => requests({ url: `/cart/addToCart/${id}/${skuNum}`, method: 'post' })
//获取购物车列表 /api/cart/cartList get
export const reqShopList = () => requests.get('/cart/cartList')
// 删除购物车列表 /api/cart/deleteCart/{skuId} delete
export const reqDeleteCartList = (id) => requests({ url: `/cart/deleteCart/${id}`, method: 'delete' })
//修改商品的选中状态 /api/cart/checkCart/{skuId}/{isChecked} get
export const reqUpdateCheckedById = (id, isChecked) => requests.get(`/cart/checkCart/${id}/${isChecked}`)
//获取验证码  /api/user/passport/sendCode/{phone} get
export const reqGetCode = (phone) => requests.get(`/user/passport/sendCode/${phone}`)
//用户注册 /api/user/passport/register post
export const reqUserRegister = (data) => requests({ url: '/user/passport/register', data, method: 'post' })
//登录 /api/user/passport/login post
export const reqUserLogin = (data) => requests({ url: '/user/passport/login', data, method: 'post' })
//获取用户信息(带着用户的token向服务器要用户信息) /api/user/passport/auth/getUserInfo get
export const reqUserInfo = () => requests.get('/user/passport/auth/getUserInfo')
//退出登录 /api/user/passport/logout get
export const reqLogout =()=>requests.get('/user/passport/logout')
//获取用户地址信息 /api/user/userAddress/auth/findUserAddressList  get
export const reqAddressInfo =()=>requests.get('/user/userAddress/auth/findUserAddressList')
//获取商品清单 /api/order/auth/trade get
export const reqOrderInfo =()=>requests.get('/order/auth/trade')
//提交订单 /api/order/auth/submitOrder?tradeNo={tradeNo} post
export const reqSubmitOrder =(tradeNo,data)=>requests({url:`/order/auth/submitOrder?tradeNo=${tradeNo}`,data,method:'post'})
//获取支付信息 /api/payment/weixin/createNative/{orderId} get
export const reqPayInfo =(orderId)=>requests.get(`/payment/weixin/createNative/${orderId}`)
//获取支付订单状态 /api/payment/weixin/queryPayStatus/{orderId} get
export const reqPayStatus =(orderId)=>requests.get(`/payment/weixin/queryPayStatus/${orderId}`)
//获取我的订单列表 api/order/auth/{page}/{limit} get
export const reqMyOrderList =(page,limit)=>requests.get(`/order/auth/${page}/${limit}`)